<?php
abstract class Pageley_Util_AbstractEnumeration implements Pageley_Util_Enumeration {

	private $name;
	private $ordinal;
	
	public function __construct($name, $ordinal = 0) {
		$this->name = $name;
		$this->ordinal = $ordinal;
	}
	
	public function getName() {
		return $this->name;
	}
	
	public function getOrdinal() {
		return $this->ordinal;
	}
	
	public function __toString() {
		return $this->name;
	}
    
    public function equals($object) {
        return $this === $object;
    }
    
    public function compareTo($object) {
        if(!($object instanceof Pageley_Util_AbstractEnumeration)) {
            throw new Pageley_Util_IllegalArgumentException("Unable to compare with '" . $object . "'.");
        }
        return $this->getOrdinal() - $object->getOrdinal();
    }
}